---
title: TextLoader
---

```{=mdx}

<Tip>
**Compatibility**


Only available on Node.js.

</Tip>

```

This notebook provides a quick overview for getting started with `TextLoader` [document loaders](/oss/concepts/document_loaders). For detailed documentation of all `TextLoader` features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain.document_loaders_fs_text.TextLoader.html).

## Overview

### Integration details

| Class | Package | Compatibility | Local | PY support |
| :--- | :--- | :---: | :---: |  :---: |
| [TextLoader](https://api.js.langchain.com/classes/langchain.document_loaders_fs_text.TextLoader.html) | [langchain](https://api.js.langchain.com/modules/langchain.document_loaders_fs_text.html) | Node-only | ✅ | ❌ |

## Setup

To access `TextLoader` document loader you'll need to install the `langchain` package.

### Installation

The LangChain TextLoader integration lives in the `langchain` package:

```{=mdx}
import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx";
<IntegrationInstallTooltip></IntegrationInstallTooltip>

<Npm2Yarn>
  langchain
</Npm2Yarn>

```

## Instantiation

Now we can instantiate our model object and load documents:

```typescript
import { TextLoader } from "langchain/document_loaders/fs/text"

const loader = new TextLoader("../../../../../../examples/src/document_loaders/example_data/example.txt")
```

## Load

```typescript
const docs = await loader.load()
docs[0]
```

```output
Document {
  pageContent: 'Foo\nBar\nBaz\n\n',
  metadata: {
    source: '../../../../../../examples/src/document_loaders/example_data/example.txt'
  },
  id: undefined
}
```

```typescript
console.log(docs[0].metadata)
```

```output
{
  source: '../../../../../../examples/src/document_loaders/example_data/example.txt'
}
```

## API reference

For detailed documentation of all TextLoader features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain.document_loaders_fs_text.TextLoader.html).
